# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=operative
pkgver=148.163acdf
pkgrel=1
epoch=1
pkgdesc='Framework based on fingerprint action, this tool is used for get information on a website or a enterprise target with multiple modules (Viadeo search,Linkedin search, Reverse email whois, Reverse ip whois, SQL file forensics ...).'
groups=('blackarch' 'blackarch-fingerprint')
arch=('x86_64' 'aarch64')
url='https://github.com/graniet/operative-framework'
license=('Apache')
depends=('sqlite')
makedepends=('git' 'go')
source=("$pkgname::git+https://github.com/graniet/operative-framework.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  rm -r glide.* vendor

}

build() {
  cd $pkgname

  GOPATH="$srcdir" go mod init go.mod
  GOPATH="$srcdir" go mod edit -replace gopkg.in/ahmdrz/goinsta.v2@v2.4.5=github.com/ahmdrz/goinsta/v2@v2.4.5
  GOPATH="$srcdir" go mod tidy
  GOPATH="$srcdir" go mod download
  GOPATH="$srcdir" CGO_ENABLED=1 go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -ldflags "-s -w" \
    -o $pkgname .
}

package() {
  cd $pkgname

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

